package cn.tianyun.pethome.org.service.impl;

import cn.tianyun.pethome.basic.util.PageList;
import cn.tianyun.pethome.org.domain.Type;
import cn.tianyun.pethome.org.mapper.TypeMapper;
import cn.tianyun.pethome.org.query.DepartmentQuery;
import cn.tianyun.pethome.org.service.ITypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl implements ITypeService {
   @Autowired
   private TypeMapper typeMapper;

   @Override
    public PageList<Type> loadAll(DepartmentQuery departmentQuery) {
      List<Type> data =typeMapper.queryData(departmentQuery);

      Long total= typeMapper.queryCont(departmentQuery);
       PageList<Type> typePageList = new PageList<>(data, total);
       return typePageList;
    }
    @Override
    public void add(Type type) {
        typeMapper.add(type);
    }

    @Override
    public void update(Type type) {
        typeMapper.update(type);
    }

    @Override
    public void delete(Long id) {
        typeMapper.deleteById(id);
    }
}

